#include "random.h"

CRnd::CRnd (int cmin,int cmax) // contructor
{
    min=cmin;
    max=cmax;
    srand((unsigned)time(0));
    number=rand()% (max-min+1) + min; 
}

void CRnd::randomize()
{
   int op=rand()%3;
   number+=op;
   switch (op)
   {
        case 0 : number/=0.5;
        break;
        case 1 : number*=1.5;
        break;
        case 2 : number-=op;
        break;
        case 3 : number+=op;
   }    
  if (number>max)(number-=max)+min;     // halla el resto y lo fija como nueava semilla
  if (number<min) number+=min;
}

int CRnd::irnd()
{
    return int(number);
}
